package org.snail.employee.bean;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import lombok.Data;
import lombok.ToString;
import lombok.extern.log4j.Log4j;
import org.snail.base.BaseParam;
import org.snail.config.CustomDateSerializer;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import java.util.Objects;

@Data
@ToString
@Log4j
public class EmployeesDO extends BaseParam implements Serializable {
    //主键
    private Integer empId;
    //外键
    private Integer viceId;
    //入职日期
    @JsonSerialize(using = CustomDateSerializer.class)
    private Date entryDate;
    //上项日期
    @JsonSerialize(using = CustomDateSerializer.class)
    private Date projectOnlineDate;
    //下项日期
    @JsonSerialize(using = CustomDateSerializer.class)
    private Date projectOfflineDate;
    //离职日期
    @JsonSerialize(using = CustomDateSerializer.class)
    private Date departureDate;
    //状态
    private Integer state;
    //详细状态
    private String stateDetail;
    //姓名
    private String name;  //
    //工号
    private String workNum;  //
    //性别
    private String sex;
    //学历
    private String education;
    //年龄
    private Integer age;
    //技能
    private String skill;
    //级别
    private String level;
    //最新薪资
    private Double latestSalary;
    //转正薪资
    private Double positiveSalary;
    //试用薪资
    private Double trialSalary;
    //试用
    private Integer trial;
    //一级项目
    private String oneLevelPro;
    //效率
    private String rate;
    //邮箱
    private String email;
    //部门
    private String department;
    //职务
    private String job;
    //办公城市
    private String officeCity;
    //是否交付
    private String delivered;
    //在职状态
    private String onTheJobStatus;
    //用工类型
    private String typeOfLabor;
    //用工状态
    private String workingState;
    //添加钉钉群组ID
    private Integer groupId;
    //群名称
    private String groupName;
    //外包工号
    private String outNum;
    //客户类型
    private String customerType;
    //手机号
    private String phone;
    private String dingId;    //钉钉用户id
    private List<Long> groupIds;    //群组对象

    @Override
    public boolean equals(Object object) {
        if (this == object) return true;
        if (!(object instanceof EmployeesDO)) return false;
        if (!super.equals(object)) return false;
        EmployeesDO that = (EmployeesDO) object;
        return Objects.equals(empId, that.empId) && Objects.equals(viceId, that.viceId) && Objects.equals(entryDate, that.entryDate) && Objects.equals(projectOnlineDate, that.projectOnlineDate) && Objects.equals(projectOfflineDate, that.projectOfflineDate) && Objects.equals(departureDate, that.departureDate) && Objects.equals(state, that.state) && Objects.equals(stateDetail, that.stateDetail) && Objects.equals(name, that.name) && Objects.equals(workNum, that.workNum) && Objects.equals(sex, that.sex) && Objects.equals(education, that.education) && Objects.equals(age, that.age) && Objects.equals(skill, that.skill) && Objects.equals(level, that.level) && Objects.equals(latestSalary, that.latestSalary) && Objects.equals(positiveSalary, that.positiveSalary) && Objects.equals(trialSalary, that.trialSalary) && Objects.equals(trial, that.trial) && Objects.equals(oneLevelPro, that.oneLevelPro) && Objects.equals(rate, that.rate) && Objects.equals(email, that.email) && Objects.equals(department, that.department) && Objects.equals(job, that.job) && Objects.equals(officeCity, that.officeCity) && Objects.equals(delivered, that.delivered) && Objects.equals(onTheJobStatus, that.onTheJobStatus) && Objects.equals(typeOfLabor, that.typeOfLabor) && Objects.equals(workingState, that.workingState) && Objects.equals(groupId, that.groupId) && Objects.equals(outNum, that.outNum) && Objects.equals(customerType, that.customerType) && Objects.equals(phone, that.phone);
    }

    @Override
    public int hashCode() {
        Integer empId = this.empId;
        if (null == empId){
            log.error("员工实体中需要有id!");
        }
        return empId.hashCode();
    }
}